package member.model.dao;

import java.io.IOException;
import java.io.Reader;
import java.sql.SQLException;

import member.to.MemberTO;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

public class TranningDAO {
	private static TranningDAO instance = new TranningDAO();
	private SqlMapClient sqlmap;
	private TranningDAO(){
		
		try {
		Reader reader = Resources.getResourceAsReader("member/config/SqlMapConfig.xml");
			sqlmap = SqlMapClientBuilder.buildSqlMapClient(reader);
		} catch (IOException e) {
					e.printStackTrace();
		}		
	}
	public static TranningDAO getinstance(){
		return instance;
	}
	public MemberTO selectMemberById(String id)throws SQLException{
		MemberTO mto =(MemberTO) sqlmap.queryForObject("selectMemberById");
		return mto;
	}
	
	public static void main(String[] args)throws SQLException {
		TranningDAO dao = TranningDAO.getinstance();
		MemberTO mto = dao.selectMemberById("nba1234");
		System.out.println(mto);
	}
	
}
